<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<jsp:include page="/jsp/layout/cabecalho.jsp" flush="true"></jsp:include>
<jsp:include page="/jsp/layout/menu.jsp" flush="true"></jsp:include>

<div id="box_principal">
	<div id="box_top">&nbsp;</div>
	<div id="box_titulo"><font class="titulo"><b>Controle Usu&aacute;rios</b></font></div>
	<div id="box_form" class="texto">
		<table border="0" align="center" id="ctrl">
			<tr>
				<td colspan="9">&nbsp;</td>
			</tr>
			<form action="/SDC/CadastrosServlet?action=10" method="post">
				<tr style="font-size: 16px; background-color: gray;">
					<td><input name="proc_nome"></input></td>
					<td><input name="proc_usuario"></input></td>
					<td><input name="proc_dt_cadastro"></input></td>
					<td><select name="proc_id_situacao">
					<option value="" selected="selected"></option>
					<option value="1" >Ativo</option>
					<option value="2">Bloqueado </option>
					<option value="3">Excluido </option>
					</select></td>
					<td colspan="4" align="center"><input type="submit" value="Pesquisar"></input></td>
				</tr>
			</form>
			
			<tr style="font-size: 18px; text-align: center; background-color:gray;	 ">
				<td>Nome</td>
				<td>Usu&aacute;rio</td>
				<td>Data Cadastro</td>
				<td>Situa&ccedil;&atilde;o</td>
				<td colspan="4" align="center">A&ccedil;&otilde;es</td>
			</tr>
		
			<c:forEach items="${usuarios}" var="usuario">
				<tr>
					<td><c:out value="${usuario.nome}" default="Não encontrado" /></td>
					<td><c:out value="${usuario.usuario}" default="Não encontrado" /></td>
					<td align="center"><c:out value="${usuario.dt_cadastro}" default="Não encontrado" /></td>
					<td align="center">
						<c:choose>
							<c:when test="${usuario.id_situacao == 1}">
							 	<c:out value="Ativo" default="Não encontrado" />
							</c:when>
							<c:when test="${usuario.id_situacao == 2}">
							 	<c:out value="Bloqueado" default="Não encontrado" />
							</c:when>
							<c:when test="${usuario.id_situacao == 3}">
							 	<c:out value="Excluãdo" default="Não encontrado" />
							</c:when>
							
						</c:choose>				
					</td>
					<td>
						<a href="CadastrosServlet?action=3&id_usuario=${usuario.id_usuario}" title="Remover Usu&aacute;rio">
							<img src="/SDC/images/button_cancel.png" width="16" height="16">
						</a>
					</td>
					<td>
						<a href="CadastrosServlet?action=9&id_usuario=${usuario.id_usuario}" title="Bloquear Usu&aacute;rio">
							<img src="/SDC/images/lock.png"	width="16" height="16">
						</a>
					</td>
					<td>
						<a href="/SDC/jsp/forms/atualizar_usuario.jsp"	title="Editar Usu&aacute;rio">
							<img src="/SDC/images/edit.png"	width="16" height="16">
						</a>
					</td>
					<td align="center">
						<img src="/SDC/images/change.png" width="16" height="16" onclick="alteraNivel(${usuario.id_usuario})" title="Alterar Nivel">				
					</td>
				</tr>
			</c:forEach>
			<tr>
				<td colspan="9" align="center"></td>
			</tr>
			<tr align="center">
				<td colspan="9">Resultados [${fn:length(usuarios)}]</td>
			</tr>
		</table>
	</div>
	<div id="box_bottom">&nbsp;</div>
</div>

<jsp:include page="/jsp/layout/rodape.jsp" flush="true"></jsp:include>
<jsp:include page="/jsp/sistema/controle/alterarNivel.jsp"></jsp:include>